package com.dream.myqiyi.ui;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.Window;

public class BaseActivity extends Activity {
	protected static final String EXIT_ACTION = "com.renren.android.exit";

	public void finish() {
		super.finish();
		overridePendingTransition(0, 0);
	}

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
	}

	protected void onResume() {
		super.onResume();
		IntentFilter filter = new IntentFilter();
		filter.addAction(EXIT_ACTION);
		this.registerReceiver(receiver, filter);
	}

	protected void onDestroy() {
		super.onDestroy();
		unregisterReceiver(receiver);
	}

	private BroadcastReceiver receiver = new BroadcastReceiver() {

		public void onReceive(Context context, Intent intent) {
			finish();
			android.os.Process.killProcess(android.os.Process.myPid());
			System.exit(0);
		}
	};
}
